package com.erp.erp_servers.Cost.imp;

import com.erp.erp_dao.Cost.CostPaymentDao;
import com.erp.erp_entitys.Cost.entity.CostPaymentEntity;
import com.erp.erp_entitys.Cost.vo.QueryBillCompanyBankAccountVO;
import com.erp.erp_entitys.Cost.vo.QueryBillCompanyBankNameVO;
import com.erp.erp_servers.Cost.CostPaymentService;
import com.erp.utils.R;
import com.erp.utils.ResultStatusEnum;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import java.util.List;
import java.util.stream.Collectors;

/**
 * @author zjk
 * @version 1.0
 * @description
 * @date 2020/11/28/028 19:44
 */
@Service
public class CostPaymentServiceImpl implements CostPaymentService {

    private final CostPaymentDao costPaymentDao;

    @Autowired
    public CostPaymentServiceImpl(CostPaymentDao costPaymentDao) {
        this.costPaymentDao = costPaymentDao;
    }

    @Override
    public List<CostPaymentEntity> findAllByCostCode(String costCode) {
        return costPaymentDao.findAllByCostCode(costCode);
    }

    @Override
    public List<QueryBillCompanyBankNameVO> getBankDetailByBillCompanyCode(String code) {
        return costPaymentDao.getBankDetailByBillCompanyCode(code);
    }

    @Override
    public QueryBillCompanyBankAccountVO getBankAccountByBankName(String bankName,String billCompanyCode) {
        return costPaymentDao.getBankAccountByBankName(bankName,billCompanyCode);
    }

    @Override
    public Integer insertCostPayment(CostPaymentEntity costPayment) {
        return costPaymentDao.insertCostPayment(costPayment);
    }

    @Override
    public Integer updateCostPayment(CostPaymentEntity costPayment) {
        return costPaymentDao.updateByPrimaryKeySelective(costPayment);
    }

    @Override
    public Integer updateCostPaymentInvalid(Integer valid, List<Integer> ids) {
        return  costPaymentDao.updateCostPaymentInvalid(0, ids);
    }


}
